﻿#region imports

using System;
using System.Text;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;

using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.Business
{
    public class AssetMetaData : IAssetMetaData
    {
        #region properties

        [XmlElement ( "id" )]
        public int ID { get; set; }

        [XmlIgnore]
        public int MetaDataID { get; set; }

        [XmlIgnore]
        public int AssetID { get; set; }

        [XmlIgnore]
        public int StatusID { get; set; }

        [XmlElement ( "asset" )]
        public IAsset Asset { get; set; }

        [XmlElement ( "metadata" )]
        public IMetaData MetaData { get; set; }

        [XmlElement ( "status" )]
        public IStatus Status { get; set; }

        #endregion

        #region constructors

        public AssetMetaData ( ) { }
        public AssetMetaData ( int id , int metaDataId , int assetId , int statusId )
        {
            this.ID = id;
            this.MetaDataID = metaDataId;
            this.AssetID = assetId;
            this.StatusID = statusId;
        }
        public AssetMetaData ( IAssetMetaData entity )
        {
            this.ID = entity.ID;
            this.MetaDataID = entity.MetaDataID;
            this.AssetID = entity.AssetID;
            this.StatusID = entity.StatusID;
        }
        public AssetMetaData ( IAssetMetaData entity, IMetaData metaData )
        {
            this.ID = entity.ID;
            this.MetaDataID = entity.MetaDataID;
            this.AssetID = entity.AssetID;
            this.StatusID = entity.StatusID;
        }
        public AssetMetaData ( IMetaData metaData )
        {
            this.MetaData = metaData;
        }

        #endregion

        #region overridden methods

        public override string ToString ( )
        {
            StringBuilder str = new StringBuilder ( );

            str.Append ( "-> ID: " + this.ID.ToString ( ) );
            str.Append ( "-> MetaDataID: " + this.MetaDataID.ToString ( ) );
            str.Append ( "-> AssetID: " + this.AssetID.ToString ( ) );
            str.Append ( "-> StatusID: " + this.StatusID.ToString ( ) );

            return str.ToString ( );
        }

        #endregion
    }
}
